//导入vue-router
import { createRouter, createWebHistory } from 'vue-router'
//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import UserAvatar from '@/views/user/UserAvatar.vue'
import UserInfo from '@/views/user/UserInfo.vue'
import UserPassword from '@/views/user/UserResetPassword.vue'
import ArticleCategory from '@/views/article/ArticleCategory.vue'
import ArticleManage from '@/views/article/ArticleManage.vue'

//定义路由关系
const routes = [
    { path: '/login', component: LoginVue },
    { path: '/', component: LayoutVue ,
        redirect: '/category/list',
        children:[
            { path: '/user/updateAvatar', component: UserAvatar },
            { path: '/user/userInfo', component: UserInfo },
            { path: '/user/updatePwd', component: UserPassword },
            { path: '/category/list', component: ArticleCategory },
            { path: '/article/detail', component: ArticleManage },
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
});

export default router